from app.commons.db import db


class Base(object):
    def save(self):
        db.session.flush()
        db.session.add(self)
        db.session.commit()

    def delete(self):
        db.session.flush()
        db.session.delete(self)
        db.session.commit()

    def db_roll_back(self):
        db.session.rollback()
